#ifndef __CONFIG__
#define __CONFIG__

#include "serialize.h"

class Config {
	public:
		Config();
		void Init(const std::string& filename);
		void Save(const std::string& filename);

		std::string dataPath;

		//general variables
		Vec3n eye, lookat, up;
		Vec3n translate, scale, rotate;
		Mat4x4n T;

		Vec3n light;
		int spp;
		int screenwidth, screenheight;
		std::vector<Vec3n> color;
		std::string texture;

		Vec2n urange, vrange, wrange;
		math::Vec3i controlmesh;  //N M O
		math::Vec3i degree; //p q r
		size_t EPP; //evaluations per patch
		nfloat epsilon;
	
		bool perspective;
		bool renderControlPolygon, renderIsoLines;

		//specific variable (e.g. test cylinder for iga)
		nfloat radius1;
		nfloat radius2;
		nfloat height;

		Vec3n load;
		nfloat youngModulus;
		nfloat poissonRatio;
	
		template<class Archive>
		void serialize(Archive & ar, const unsigned int version) {
			ar & boost::serialization::make_nvp("DataPath", dataPath);
			ar & boost::serialization::make_nvp("Eye", eye);
			ar & boost::serialization::make_nvp("Lookat", lookat);
			ar & boost::serialization::make_nvp("Up", up);
			ar & boost::serialization::make_nvp("Perspective", perspective);
			ar & boost::serialization::make_nvp("Light", light);
			ar & boost::serialization::make_nvp("Translate", translate);
			ar & boost::serialization::make_nvp("Scale", scale);
			ar & boost::serialization::make_nvp("Rotate", rotate);
			ar & boost::serialization::make_nvp("Screenwidth", screenwidth);
			ar & boost::serialization::make_nvp("Screenheight", screenheight);
			ar & boost::serialization::make_nvp("SPP", spp);
			ar & boost::serialization::make_nvp("Color", color);
			ar & boost::serialization::make_nvp("Texture", texture);
			ar & boost::serialization::make_nvp("urange", urange);
			ar & boost::serialization::make_nvp("vrange", vrange);
			ar & boost::serialization::make_nvp("wrange", wrange);
			ar & boost::serialization::make_nvp("ShowControlpolygon", renderControlPolygon);
			ar & boost::serialization::make_nvp("ShowIsolines", renderIsoLines);
			ar & boost::serialization::make_nvp("ControlmeshResolution", controlmesh);
			ar & boost::serialization::make_nvp("Degree", degree);
			ar & boost::serialization::make_nvp("EPP", EPP);
			ar & boost::serialization::make_nvp("Radius1", radius1);
			ar & boost::serialization::make_nvp("Radius2", radius2);
			ar & boost::serialization::make_nvp("Height", height);
			ar & boost::serialization::make_nvp("Load", load);
			ar & boost::serialization::make_nvp("YoungModulus", youngModulus);
			ar & boost::serialization::make_nvp("PoissonRatio", poissonRatio);
			ar & boost::serialization::make_nvp("Epsilon", epsilon);
		}
};

#endif //__CONFIG__
